package cn.buk.tms.dto;

import cn.buk.tms.entity.misc.CustomerServiceTemplate;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.beans.BeanUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 客户服务收费模板
 * 
 * @author yfdai
 */

public class CustomerServiceTemplateDto {

    private int id;

    /**
     * 模板代码：A、B等
     */
    private String templateCode;

    /**
     * 模板名称：A模板、B模板等
     */
    private String templateName;

    /**
     * 机票价格模式:
     * 0 黑屏公布运价
     * 1 大客户优选票面
     */
    private int flightPriceMode;

    /**
     * 机票出票服务费(每人每段）
     * 机票保险和机票出票服务费二选一
     */
    private int flightTicketingFee;

    /**
     * 机票保险(每人每段）
     * 机票保险和机票出票服务费二选一
     * 此处只指定需要购买的保险金额，具体哪个险种待定
     */
    private int flightInsurance;

    /**
     * 机票退票服务费（每人每段）
     */
    private int flightRefundFee;

    /**
     * 机票更改服务费（每人每段）
     */
    private int flightChangeFee;

    /**
     * 服务费报表显示设置
     * 0-不单独显示，与航司销售价、航司退票费、航司改签费合并
     * 1-单独显示
     */
    private int reportShowFee;

    /**
     * 是否可以买GP机票
     * government purchase
     * 0 - 不可开GP
     * 1 - 可开GP
     * 2 - 仅开GP
     */
    private int gpMode;

  /**
   * 规则执行强度
     * 0 - 弱
     * 10 - 强
     *
     */
    private int strength;

  /**
   * 航班相关的特定规则
   */
  private List<CustomerServiceFlightRuleDto> flightRules;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date lastUpdate;

  public static CustomerServiceTemplateDto createBy(CustomerServiceTemplate tpl) {
    CustomerServiceTemplateDto dto = new CustomerServiceTemplateDto();
    BeanUtils.copyProperties(tpl, dto);
    return dto;
  }

  public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }


    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public Date getLastUpdate() {
        return lastUpdate;
    }

    public void setLastUpdate(Date lastUpdate) {
        this.lastUpdate = lastUpdate;
    }

    public String getTemplateCode() {
        return templateCode;
    }

    public void setTemplateCode(String templateCode) {
        if (templateCode != null) {
            this.templateCode = templateCode.trim().toUpperCase();
        }
    }

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public int getFlightPriceMode() {
        return flightPriceMode;
    }

    public void setFlightPriceMode(int flightPriceMode) {
        this.flightPriceMode = flightPriceMode;
    }

    public int getFlightTicketingFee() {
        return flightTicketingFee;
    }

    public void setFlightTicketingFee(int flightTicketingFee) {
        this.flightTicketingFee = flightTicketingFee;
    }

    public int getFlightInsurance() {
        return flightInsurance;
    }

    public void setFlightInsurance(int flightInsurance) {
        this.flightInsurance = flightInsurance;
    }

    public int getFlightRefundFee() {
        return flightRefundFee;
    }

    public void setFlightRefundFee(int flightRefundFee) {
        this.flightRefundFee = flightRefundFee;
    }

    public int getFlightChangeFee() {
        return flightChangeFee;
    }

    public void setFlightChangeFee(int flightChangeFee) {
        this.flightChangeFee = flightChangeFee;
    }

    public int getReportShowFee() {
        return reportShowFee;
    }

    public void setReportShowFee(int reportShowFee) {
        this.reportShowFee = reportShowFee;
    }

    public int getGpMode() {
        return gpMode;
    }

    public void setGpMode(int gpMode) {
        this.gpMode = gpMode;
    }

    public int getStrength() {
        return strength;
    }

    public void setStrength(int strength) {
        this.strength = strength;
    }

  public List<CustomerServiceFlightRuleDto> getFlightRules() {
    if (flightRules == null) {
      flightRules = new ArrayList<>();
    }
    return flightRules;
  }

  public void setFlightRules(List<CustomerServiceFlightRuleDto> flightRules) {
    this.flightRules = flightRules;
  }
}
